﻿@using Demo.Model;
@using Pampa.MVC.Helpers;
@using Pampa.MVC.Models;
@using Pampa.MVC.Fluent.Common;

@{
    Layout = "~/Views/Shared/Layout.cshtml";
    ViewBag.Title = "Playground";
}

<h2>Playground</h2>

<div class="controls">
    
    <div class="datepicker">
        @(Html.Pampa().DatePicker("date"))
    </div>
    
    <div class="selector">
        @(Html.Pampa().Selector("selector").EmptyText("seleccione").Width(300).DataHandler("fillSelector"))
    </div>

</div>

<script type="text/javascript">
    
function fillSelector(selectorId, value, maxtam) {
    var mselector = Selector_Instances[selectorId];

    // todo ajax
    // EntitySelector.GetList(mselector.entityName, value, maxtam, EntitySelector_GetListCallBack, { id: selectorId, value: value });
}

function fillSelector_callback(response) {
    
    // callback
    
    /*
    if ((response.error) && (typeof (response.error) != "xml")) {
        alert(response.error);
    }
    else {
        var doc = response.request.responseXML;
        var selectorId = response.context.id;
        var value = response.context.value;
        var selector = Selector_Get(selectorId);

        if (selector.getDescription() == value) {
            Selector_Fill(selectorId, doc);
        }
    }
    */
}        
    
</script>